package com.atguigu.spring.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

public class Farmer {

    private Integer farmerId;
    private String farmerName;

    // 如果通过 JSON 请求体发送数据，那么 @DateTimeFormat 注解就会失效
    // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date farmerBirthday;

    public Integer getFarmerId() {
        return farmerId;
    }

    public void setFarmerId(Integer farmerId) {
        this.farmerId = farmerId;
    }

    public String getFarmerName() {
        return farmerName;
    }

    public void setFarmerName(String farmerName) {
        this.farmerName = farmerName;
    }

    public Date getFarmerBirthday() {
        return farmerBirthday;
    }

    public void setFarmerBirthday(Date farmerBirthday) {
        this.farmerBirthday = farmerBirthday;
    }

    @Override
    public String toString() {
        return "Farmer{" +
                "farmerId=" + farmerId +
                ", farmerName='" + farmerName + '\'' +
                ", farmerBirthday=" + farmerBirthday +
                '}';
    }

    public Farmer(Integer farmerId, String farmerName, Date farmerBirthday) {
        this.farmerId = farmerId;
        this.farmerName = farmerName;
        this.farmerBirthday = farmerBirthday;
    }

    public Farmer() {
    }
}
